From fd66273c941e04e3fde22f4b2593ed91f9824122 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 19 Apr 2014 01:19:46 +0200 Subject: [PATCH] Fixed some @params documentation (includes/[cache|objectcache]) Swapped some "$var type" to "type $var" or added missing types before the $var. Changed some other types to match the more common spelling. Makes beginning of some text in captial. Also added some missing @param. Change-Id: I86fd10e3f2d4bb80e7432533038d124693acfb3c --- includes/cache/BacklinkCache.php | 40 ++-- includes/cache/CacheDependency.php | 24 +-- includes/cache/FileCacheBase.php | 4 +- includes/cache/GenderCache.php | 20 +- includes/cache/HTMLFileCache.php | 12 +- includes/cache/LinkBatch.php | 33 ++-- includes/cache/LinkCache.php | 26 +-- includes/cache/LocalisationCache.php | 97 +++++----- includes/cache/MapCacheLRU.php | 16 +- includes/cache/MessageCache.php | 34 ++-- includes/cache/ObjectFileCache.php | 4 +- includes/cache/ResourceFileCache.php | 4 +- includes/cache/UserCache.php | 10 +- includes/objectcache/APCBagOStuff.php | 28 +-- includes/objectcache/BagOStuff.php | 96 +++++----- includes/objectcache/EmptyBagOStuff.php | 28 +-- includes/objectcache/HashBagOStuff.php | 24 +-- includes/objectcache/MemcachedBagOStuff.php | 42 +++-- includes/objectcache/MemcachedClient.php | 175 +++++++++--------- .../objectcache/MemcachedPeclBagOStuff.php | 53 +++--- .../objectcache/MemcachedPhpBagOStuff.php | 28 +-- includes/objectcache/MultiWriteBagOStuff.php | 64 +++---- includes/objectcache/ObjectCache.php | 12 +- .../objectcache/ObjectCacheSessionHandler.php | 31 ++-- includes/objectcache/RedisBagOStuff.php | 15 +- includes/objectcache/SqlBagOStuff.php | 60 +++--- includes/objectcache/WinCacheBagOStuff.php | 22 +-- includes/objectcache/XCacheBagOStuff.php | 28 +-- 28 files changed, 537 insertions(+), 493 deletions(-) diff --git a/includes/cache/BacklinkCache.php b/includes/cache/BacklinkCache.php index d2ec26ed31..ed62bba04b 100644 --- a/includes/cache/BacklinkCache.php +++ b/includes/cache/BacklinkCache.php @@ -97,7 +97,7 @@ class BacklinkCache { * Currently, only one cache instance can exist; callers that * need multiple backlink cache objects should keep them in scope. * - * @param Title $title : Title object to get a backlink cache for + * @param Title $title Title object to get a backlink cache for * @return BacklinkCache */ public static function get( Title $title ) { @@ -135,7 +135,7 @@ class BacklinkCache { /** * Set the Database object to use * - * @param $db DatabaseBase + * @param DatabaseBase $db */ public function setDB( $db ) { $this->db = $db; @@ -144,7 +144,7 @@ class BacklinkCache { /** * Get the slave connection to the database * When non existing, will initialize the connection. - * @return DatabaseBase object + * @return DatabaseBase */ protected function getDB() { if ( !isset( $this->db ) ) { @@ -168,11 +168,11 @@ class BacklinkCache { /** * Get the backlinks for a given table. Cached in process memory only. - * @param $table String - * @param $startId Integer|false - * @param $endId Integer|false - * @param $max Integer|INF - * @param $select string 'all' or 'ids' + * @param string $table + * @param int|bool $startId + * @param int|bool $endId + * @param int|INF $max + * @param string $select 'all' or 'ids' * @return ResultWrapper */ protected function queryLinks( $table, $startId, $endId, $max, $select = 'all' ) { @@ -238,7 +238,7 @@ class BacklinkCache { /** * Get the field name prefix for a given table - * @param $table String + * @param string $table * @throws MWException * @return null|string */ @@ -267,7 +267,7 @@ class BacklinkCache { /** * Get the SQL condition array for selecting backlinks, with a join * on the page table. - * @param $table String + * @param string $table * @throws MWException * @return array|null */ @@ -314,7 +314,7 @@ class BacklinkCache { /** * Check if there are any backlinks - * @param $table String + * @param string $table * @return bool */ public function hasLinks( $table ) { @@ -323,9 +323,9 @@ class BacklinkCache { /** * Get the approximate number of backlinks - * @param $table String - * @param $max integer|INF Only count up to this many backlinks - * @return integer + * @param string $table + * @param int|INF $max Only count up to this many backlinks + * @return int */ public function getNumLinks( $table, $max = INF ) { global $wgMemc, $wgUpdateRowsPerJob; @@ -372,9 +372,9 @@ class BacklinkCache { * Returns an array giving the start and end of each range. The first * batch has a start of false, and the last batch has an end of false. * - * @param string $table the links table name - * @param $batchSize Integer - * @return Array + * @param string $table The links table name + * @param int $batchSize + * @return array */ public function partition( $table, $batchSize ) { global $wgMemc; @@ -450,9 +450,9 @@ class BacklinkCache { /** * Partition a DB result with backlinks in it into batches - * @param $res ResultWrapper database result - * @param $batchSize integer - * @param $isComplete bool Whether $res includes all the backlinks + * @param ResultWrapper $res Database result + * @param int $batchSize + * @param bool $isComplete Whether $res includes all the backlinks * @throws MWException * @return array */ diff --git a/includes/cache/CacheDependency.php b/includes/cache/CacheDependency.php index 28889b50c7..7b83990fed 100644 --- a/includes/cache/CacheDependency.php +++ b/includes/cache/CacheDependency.php @@ -34,7 +34,7 @@ class DependencyWrapper { /** * Create an instance. - * @param $value Mixed: the user-supplied value + * @param mixed $value The user-supplied value * @param CacheDependency|CacheDependency[] $deps A dependency or dependency * array. All dependencies must be objects implementing CacheDependency. */ @@ -75,7 +75,7 @@ class DependencyWrapper { /** * Get the user-defined value - * @return bool|Mixed + * @return bool|mixed */ function getValue() { return $this->value; @@ -84,9 +84,9 @@ class DependencyWrapper { /** * Store the wrapper to a cache * - * @param $cache BagOStuff - * @param $key - * @param $expiry + * @param BagOStuff $cache + * @param string $key + * @param int $expiry */ function storeToCache( $cache, $key, $expiry = 0 ) { $this->initialiseDeps(); @@ -98,12 +98,12 @@ class DependencyWrapper { * it will be generated with the callback function (if present), and the newly * calculated value will be stored to the cache in a wrapper. * - * @param $cache BagOStuff a cache object such as $wgMemc - * @param string $key the cache key - * @param $expiry Integer: the expiry timestamp or interval in seconds - * @param $callback Mixed: the callback for generating the value, or false - * @param array $callbackParams the function parameters for the callback - * @param array $deps the dependencies to store on a cache miss. Note: these + * @param BagOStuff $cache A cache object such as $wgMemc + * @param string $key The cache key + * @param int $expiry The expiry timestamp or interval in seconds + * @param bool|array $callback The callback for generating the value, or false + * @param array $callbackParams The function parameters for the callback + * @param array $deps The dependencies to store on a cache miss. Note: these * are not the dependencies used on a cache hit! Cache hits use the stored * dependency array. * @@ -157,7 +157,7 @@ class FileDependency extends CacheDependency { * Create a file dependency * * @param string $filename the name of the file, preferably fully qualified - * @param $timestamp Mixed: the unix last modified timestamp, or false if the + * @param null|bool|int $timestamp The unix last modified timestamp, or false if the * file does not exist. If omitted, the timestamp will be loaded from * the file. * diff --git a/includes/cache/FileCacheBase.php b/includes/cache/FileCacheBase.php index 0c00c6b593..4bf36114c9 100644 --- a/includes/cache/FileCacheBase.php +++ b/includes/cache/FileCacheBase.php @@ -154,7 +154,7 @@ abstract class FileCacheBase { /** * Save and compress text to the cache * @param string $text - * @return string compressed text + * @return string Compressed text */ public function saveText( $text ) { global $wgUseFileCache; @@ -231,7 +231,7 @@ abstract class FileCacheBase { /** * Roughly increments the cache misses in the last hour by unique visitors - * @param $request WebRequest + * @param WebRequest $request * @return void */ public function incrMissesRecent( WebRequest $request ) { diff --git a/includes/cache/GenderCache.php b/includes/cache/GenderCache.php index 285675da17..63e7bfd746 100644 --- a/includes/cache/GenderCache.php +++ b/includes/cache/GenderCache.php @@ -50,7 +50,7 @@ class GenderCache { /** * Returns the default gender option in this wiki. - * @return String + * @return string */ protected function getDefault() { if ( $this->default === null ) { @@ -62,9 +62,9 @@ class GenderCache { /** * Returns the gender for given username. - * @param string $username or User: username - * @param string $caller the calling method - * @return String + * @param string|User $username Username + * @param string $caller The calling method + * @return string */ public function getGenderOf( $username, $caller = '' ) { global $wgUser; @@ -97,8 +97,8 @@ class GenderCache { /** * Wrapper for doQuery that processes raw LinkBatch data. * - * @param $data - * @param $caller + * @param array $data + * @param string $caller */ public function doLinkBatch( $data, $caller = '' ) { $users = array(); @@ -118,8 +118,8 @@ class GenderCache { * Wrapper for doQuery that processes a title or string array. * * @since 1.20 - * @param $titles List: array of Title objects or strings - * @param string $caller the calling method + * @param array $titles Array of Title objects or strings + * @param string $caller The calling method */ public function doTitlesArray( $titles, $caller = '' ) { $users = array(); @@ -139,8 +139,8 @@ class GenderCache { /** * Preloads genders for given list of users. - * @param $users List|String: usernames - * @param string $caller the calling method + * @param array|string $users Usernames + * @param string $caller The calling method */ public function doQuery( $users, $caller = '' ) { $default = $this->getDefault(); diff --git a/includes/cache/HTMLFileCache.php b/includes/cache/HTMLFileCache.php index 3690b703c9..91580f978f 100644 --- a/includes/cache/HTMLFileCache.php +++ b/includes/cache/HTMLFileCache.php @@ -31,8 +31,8 @@ class HTMLFileCache extends FileCacheBase { /** * Construct an ObjectFileCache from a Title and an action - * @param $title Title|string Title object or prefixed DB key string - * @param $action string + * @param Title|string $title Title object or prefixed DB key string + * @param string $action * @throws MWException * @return HTMLFileCache */ @@ -84,7 +84,7 @@ class HTMLFileCache extends FileCacheBase { /** * Check if pages can be cached for this request/user - * @param $context IContextSource + * @param IContextSource $context * @return bool */ public static function useFileCache( IContextSource $context ) { @@ -125,7 +125,7 @@ class HTMLFileCache extends FileCacheBase { /** * Read from cache to context output - * @param $context IContextSource + * @param IContextSource $context * @return void */ public function loadFromFileCache( IContextSource $context ) { @@ -155,7 +155,7 @@ class HTMLFileCache extends FileCacheBase { /** * Save this cache object with the given text. * Use this as an ob_start() handler. - * @param $text string + * @param string $text * @return bool Whether $wgUseFileCache is enabled */ public function saveToFileCache( $text ) { @@ -200,7 +200,7 @@ class HTMLFileCache extends FileCacheBase { /** * Clear the file caches for a page for all actions - * @param $title Title + * @param Title $title * @return bool Whether $wgUseFileCache is enabled */ public static function clearFileCache( Title $title ) { diff --git a/includes/cache/LinkBatch.php b/includes/cache/LinkBatch.php index 1a20ab4f4f..76cc583636 100644 --- a/includes/cache/LinkBatch.php +++ b/includes/cache/LinkBatch.php @@ -49,14 +49,14 @@ class LinkBatch { * class. Only used in debugging output. * @since 1.17 * - * @param $caller + * @param string $caller */ public function setCaller( $caller ) { $this->caller = $caller; } /** - * @param $title Title + * @param Title $title */ public function addObj( $title ) { if ( is_object( $title ) ) { @@ -67,9 +67,8 @@ class LinkBatch { } /** - * @param $ns int - * @param $dbkey string - * @return mixed + * @param int $ns + * @param string $dbkey */ public function add( $ns, $dbkey ) { if ( $ns < 0 ) { @@ -86,7 +85,7 @@ class LinkBatch { * Set the link list to a given 2-d array * First key is the namespace, second is the DB key, value arbitrary * - * @param $array array + * @param array $array */ public function setArray( $array ) { $this->data = $array; @@ -113,7 +112,7 @@ class LinkBatch { /** * Do the query and add the results to the LinkCache object * - * @return Array mapping PDBK to ID + * @return array Mapping PDBK to ID */ public function execute() { $linkCache = LinkCache::singleton(); @@ -125,8 +124,8 @@ class LinkBatch { * Do the query and add the results to a given LinkCache object * Return an array mapping PDBK to ID * - * @param $cache LinkCache - * @return Array remaining IDs + * @param LinkCache $cache + * @return array Remaining IDs */ protected function executeInto( &$cache ) { wfProfileIn( __METHOD__ ); @@ -144,9 +143,9 @@ class LinkBatch { * This function *also* stores extra fields of the title used for link * parsing to avoid extra DB queries. * - * @param $cache LinkCache - * @param $res - * @return Array of remaining titles + * @param LinkCache $cache + * @param ResultWrapper $res + * @return array Array of remaining titles */ public function addResultToCache( $cache, $res ) { if ( !$res ) { @@ -178,7 +177,7 @@ class LinkBatch { /** * Perform the existence test query, return a ResultWrapper with page_id fields - * @return Bool|ResultWrapper + * @return bool|ResultWrapper */ public function doQuery() { if ( $this->isEmpty() ) { @@ -207,7 +206,7 @@ class LinkBatch { /** * Do (and cache) {{GENDER:...}} information for userpages in this LinkBatch * - * @return bool whether the query was successful + * @return bool Whether the query was successful */ public function doGenderQuery() { if ( $this->isEmpty() ) { @@ -228,9 +227,9 @@ class LinkBatch { /** * Construct a WHERE clause which will match all the given titles. * - * @param string $prefix the appropriate table's field name prefix ('page', 'pl', etc) - * @param $db DatabaseBase object to use - * @return mixed string with SQL where clause fragment, or false if no items. + * @param string $prefix The appropriate table's field name prefix ('page', 'pl', etc) + * @param DatabaseBase $db DatabaseBase object to use + * @return string|bool String with SQL where clause fragment, or false if no items. */ public function constructSet( $prefix, $db ) { return $db->makeWhereFrom2d( $this->data, "{$prefix}_namespace", "{$prefix}_title" ); diff --git a/includes/cache/LinkCache.php b/includes/cache/LinkCache.php index de2a728b06..95b15b8b14 100644 --- a/includes/cache/LinkCache.php +++ b/includes/cache/LinkCache.php @@ -78,7 +78,7 @@ class LinkCache { /** * General accessor to get/set whether SELECT FOR UPDATE should be used * - * @param $update + * @param bool $update * @return bool */ public function forUpdate( $update = null ) { @@ -86,7 +86,7 @@ class LinkCache { } /** - * @param $title + * @param string $title * @return array|int */ public function getGoodLinkID( $title ) { @@ -100,9 +100,9 @@ class LinkCache { /** * Get a field of a title object from cache. * If this link is not good, it will return NULL. - * @param $title Title + * @param Title $title * @param string $field ('length','redirect','revision','model') - * @return mixed + * @return string|null */ public function getGoodLinkFieldObj( $title, $field ) { $dbkey = $title->getPrefixedDBkey(); @@ -114,7 +114,7 @@ class LinkCache { } /** - * @param $title + * @param string $title * @return bool */ public function isBadLink( $title ) { @@ -147,8 +147,8 @@ class LinkCache { /** * Same as above with better interface. * @since 1.19 - * @param $title Title - * @param $row object which has the fields page_id, page_is_redirect, + * @param Title $title + * @param stdClass $row Object which has the fields page_id, page_is_redirect, * page_latest and page_content_model */ public function addGoodLinkObjFromRow( $title, $row ) { @@ -163,7 +163,7 @@ class LinkCache { } /** - * @param $title Title + * @param Title $title */ public function addBadLinkObj( $title ) { $dbkey = $title->getPrefixedDBkey(); @@ -177,7 +177,7 @@ class LinkCache { } /** - * @param $title Title + * @param Title $title */ public function clearLink( $title ) { $dbkey = $title->getPrefixedDBkey(); @@ -197,8 +197,8 @@ class LinkCache { /** * Add a title to the link cache, return the page_id or zero if non-existent * - * @param string $title title to add - * @return Integer + * @param string $title Title to add + * @return int */ public function addLink( $title ) { $nt = Title::newFromDBkey( $title ); @@ -212,8 +212,8 @@ class LinkCache { /** * Add a title to the link cache, return the page_id or zero if non-existent * - * @param $nt Title object to add - * @return Integer + * @param Title $nt Title object to add + * @return int */ public function addLinkObj( $nt ) { global $wgAntiLockFlags, $wgContentHandlerUseDB; diff --git a/includes/cache/LocalisationCache.php b/includes/cache/LocalisationCache.php index 9cee321665..1c36ec0055 100644 --- a/includes/cache/LocalisationCache.php +++ b/includes/cache/LocalisationCache.php @@ -181,7 +181,7 @@ class LocalisationCache { * For constructor parameters, see the documentation in DefaultSettings.php * for $wgLocalisationCacheConf. * - * @param $conf Array + * @param array $conf * @throws MWException */ function __construct( $conf ) { @@ -228,7 +228,7 @@ class LocalisationCache { /** * Returns true if the given key is mergeable, that is, if it is an associative * array which can be merged through a fallback sequence. - * @param $key + * @param string $key * @return bool */ public function isMergeableKey( $key ) { @@ -250,8 +250,8 @@ class LocalisationCache { * * Warning: this may be slow for split items (messages), since it will * need to fetch all of the subitems from the cache individually. - * @param $code - * @param $key + * @param string $code + * @param string $key * @return mixed */ public function getItem( $code, $key ) { @@ -270,10 +270,10 @@ class LocalisationCache { /** * Get a subitem, for instance a single message for a given language. - * @param $code - * @param $key - * @param $subkey - * @return null + * @param string $code + * @param string $key + * @param string $subkey + * @return mixed|null */ public function getSubitem( $code, $key, $subkey ) { if ( !isset( $this->loadedSubitems[$code][$key][$subkey] ) && @@ -299,8 +299,8 @@ class LocalisationCache { * * Will return null if the item is not found, or false if the item is not an * array. - * @param $code - * @param $key + * @param string $code + * @param string $key * @return bool|null|string */ public function getSubitemList( $code, $key ) { @@ -318,8 +318,8 @@ class LocalisationCache { /** * Load an item into the cache. - * @param $code - * @param $key + * @param string $code + * @param string $key */ protected function loadItem( $code, $key ) { if ( !isset( $this->initialisedLangs[$code] ) ) { @@ -354,9 +354,9 @@ class LocalisationCache { /** * Load a subitem into the cache - * @param $code - * @param $key - * @param $subkey + * @param string $code + * @param string $key + * @param string $subkey */ protected function loadSubitem( $code, $key, $subkey ) { if ( !in_array( $key, self::$splitKeys ) ) { @@ -429,7 +429,7 @@ class LocalisationCache { /** * Initialise a language in this object. Rebuild the cache if necessary. - * @param $code + * @param string $code * @throws MWException */ protected function initLanguage( $code ) { @@ -490,8 +490,8 @@ class LocalisationCache { /** * Create a fallback from one language to another, without creating a * complete persistent cache. - * @param $primaryCode - * @param $fallbackCode + * @param string $primaryCode + * @param string $fallbackCode */ public function initShallowFallback( $primaryCode, $fallbackCode ) { $this->data[$primaryCode] =& $this->data[$fallbackCode]; @@ -502,8 +502,8 @@ class LocalisationCache { /** * Read a PHP file containing localisation data. - * @param $_fileName - * @param $_fileType + * @param string $_fileName + * @param string $_fileType * @throws MWException * @return array */ @@ -537,7 +537,7 @@ class LocalisationCache { * Read a JSON file containing localisation messages. * @param string $fileName Name of file to read * @throws MWException if there is a syntax error in the JSON file - * @return array with a 'messages' key, or empty array if the file doesn't exist + * @return array Array with a 'messages' key, or empty array if the file doesn't exist */ public function readJSONFile( $fileName ) { wfProfileIn( __METHOD__ ); @@ -578,6 +578,8 @@ class LocalisationCache { /** * Get the compiled plural rules for a given language from the XML files. * @since 1.20 + * @param string $code + * @return array|null */ public function getCompiledPluralRules( $code ) { $rules = $this->getPluralRules( $code ); @@ -599,6 +601,8 @@ class LocalisationCache { * Get the plural rules for a given language from the XML files. * Cached. * @since 1.20 + * @param string $code + * @return array|null */ public function getPluralRules( $code ) { if ( $this->pluralRules === null ) { @@ -615,6 +619,8 @@ class LocalisationCache { * Get the plural rule types for a given language from the XML files. * Cached. * @since 1.22 + * @param string $code + * @return array|null */ public function getPluralRuleTypes( $code ) { if ( $this->pluralRuleTypes === null ) { @@ -645,6 +651,8 @@ class LocalisationCache { /** * Load a plural XML file with the given filename, compile the relevant * rules, and save the compiled rules in a process-local cache. + * + * @param string $fileName */ protected function loadPluralFile( $fileName ) { $doc = new DOMDocument; @@ -675,6 +683,9 @@ class LocalisationCache { * Read the data from the source files for a given language, and register * the relevant dependencies in the $deps array. If the localisation * exists, the data array is returned, otherwise false is returned. + * + * @param string $code + * @param array $deps */ protected function readSourceFilesAndRegisterDeps( $code, &$deps ) { global $IP; @@ -708,9 +719,9 @@ class LocalisationCache { /** * Merge two localisation values, a primary and a fallback, overwriting the * primary value in place. - * @param $key - * @param $value - * @param $fallbackValue + * @param string $key + * @param mixed $value + * @param mixed $fallbackValue */ protected function mergeItem( $key, &$value, $fallbackValue ) { if ( !is_null( $value ) ) { @@ -739,8 +750,8 @@ class LocalisationCache { } /** - * @param $value - * @param $fallbackValue + * @param mixed $value + * @param mixed $fallbackValue */ protected function mergeMagicWords( &$value, $fallbackValue ) { foreach ( $fallbackValue as $magicName => $fallbackInfo ) { @@ -763,10 +774,10 @@ class LocalisationCache { * * Returns true if any data from the extension array was used, false * otherwise. - * @param $codeSequence - * @param $key - * @param $value - * @param $fallbackValue + * @param string $codeSequence + * @param string $key + * @param mixed $value + * @param mixed $fallbackValue * @return bool */ protected function mergeExtensionItem( $codeSequence, $key, &$value, $fallbackValue ) { @@ -784,7 +795,7 @@ class LocalisationCache { /** * Load localisation data for a given language for both core and extensions * and save it to the persistent cache store and the process cache - * @param $code + * @param string $code * @throws MWException */ public function recache( $code ) { @@ -984,7 +995,7 @@ class LocalisationCache { * * The preload item will be loaded automatically, improving performance * for the commonly-requested items it contains. - * @param $data + * @param array $data * @return array */ protected function buildPreload( $data ) { @@ -1008,7 +1019,7 @@ class LocalisationCache { /** * Unload the data for a given language from the object cache. * Reduces memory usage. - * @param $code + * @param string $code */ public function unload( $code ) { unset( $this->data[$code] ); @@ -1394,8 +1405,8 @@ class LocalisationCacheBulkLoad extends LocalisationCache { private $maxLoadedLangs = 10; /** - * @param $fileName - * @param $fileType + * @param string $fileName + * @param string $fileType * @return array|mixed */ protected function readPHPFile( $fileName, $fileType ) { @@ -1420,8 +1431,8 @@ class LocalisationCacheBulkLoad extends LocalisationCache { } /** - * @param $code - * @param $key + * @param string $code + * @param string $key * @return mixed */ public function getItem( $code, $key ) { @@ -1432,10 +1443,10 @@ class LocalisationCacheBulkLoad extends LocalisationCache { } /** - * @param $code - * @param $key - * @param $subkey - * @return + * @param string $code + * @param string $key + * @param string $subkey + * @return mixed */ public function getSubitem( $code, $key, $subkey ) { unset( $this->mruLangs[$code] ); @@ -1445,7 +1456,7 @@ class LocalisationCacheBulkLoad extends LocalisationCache { } /** - * @param $code + * @param string $code */ public function recache( $code ) { parent::recache( $code ); @@ -1455,7 +1466,7 @@ class LocalisationCacheBulkLoad extends LocalisationCache { } /** - * @param $code + * @param string $code */ public function unload( $code ) { unset( $this->mruLangs[$code] ); diff --git a/includes/cache/MapCacheLRU.php b/includes/cache/MapCacheLRU.php index 8349f885b7..a22d8023d6 100644 --- a/includes/cache/MapCacheLRU.php +++ b/includes/cache/MapCacheLRU.php @@ -31,13 +31,13 @@ * @since 1.23 */ class MapCacheLRU { - /** @var Array */ + /** @var array */ protected $cache = array(); // (key => value) protected $maxCacheKeys; // integer; max entries /** - * @param $maxKeys integer Maximum number of entries allowed (min 1). + * @param int $maxKeys Maximum number of entries allowed (min 1). * @throws MWException When $maxCacheKeys is not an int or =< 0. */ public function __construct( $maxKeys ) { @@ -52,8 +52,8 @@ class MapCacheLRU { * This will prune the cache if it gets too large based on LRU. * If the item is already set, it will be pushed to the top of the cache. * - * @param $key string - * @param $value mixed + * @param string $key + * @param mixed $value * @return void */ public function set( $key, $value ) { @@ -70,7 +70,7 @@ class MapCacheLRU { /** * Check if a key exists * - * @param $key string + * @param string $key * @return bool */ public function has( $key ) { @@ -82,7 +82,7 @@ class MapCacheLRU { * This returns null if the key is not set. * If the item is already set, it will be pushed to the top of the cache. * - * @param $key string + * @param string $key * @return mixed */ public function get( $key ) { @@ -97,7 +97,7 @@ class MapCacheLRU { /** * Clear one or several cache entries, or all cache entries * - * @param $keys string|Array + * @param string|array $keys * @return void */ public function clear( $keys = null ) { @@ -113,7 +113,7 @@ class MapCacheLRU { /** * Push an entry to the top of the cache * - * @param $key string + * @param string $key */ protected function ping( $key ) { $item = $this->cache[$key]; diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index daaa915b93..a3cf87e943 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -155,8 +155,8 @@ class MessageCache { /** * Try to load the cache from a local file. * - * @param string $hash the hash of contents, to check validity. - * @param Mixed $code Optional language code, see documenation of load(). + * @param string $hash The hash of contents, to check validity. + * @param string $code Optional language code, see documenation of load(). * @return array The cache array */ function getLocalCache( $hash, $code ) { @@ -192,6 +192,9 @@ class MessageCache { /** * Save the cache to a local file. + * @param string $serialized + * @param string $hash + * @param string $code */ function saveToLocal( $serialized, $hash, $code ) { global $wgCacheDirectory; @@ -232,7 +235,7 @@ class MessageCache { * or false if populating empty cache fails. Also returns true if MessageCache * is disabled. * - * @param bool|String $code Language to which load messages + * @param bool|string $code Language to which load messages * @throws MWException * @return bool */ @@ -580,7 +583,7 @@ class MessageCache { /** * Is the given cache array expired due to time passing or a version change? * - * @param $cache + * @param array $cache * @return bool */ protected function isCacheExpired( $cache ) { @@ -638,7 +641,7 @@ class MessageCache { * a timeout of MessageCache::MSG_LOCK_TIMEOUT. * * @param string $key - * @return Boolean: success + * @return bool Success */ function lock( $key ) { $lockKey = $key . ':lock'; @@ -687,17 +690,16 @@ class MessageCache { * * Fallbacks will be just that: fallbacks. A fallback language will never be reached if * the message is available *anywhere* in the language for which it is a fallback. * - * @param string $key the message key + * @param string $key The message key * @param bool $useDB If true, look for the message in the DB, false - * to use only the compiled l10n cache. + * to use only the compiled l10n cache. * @param bool|string|object $langcode Code of the language to get the message for. - * - If string and a valid code, will create a standard language object - * - If string but not a valid code, will create a basic language object - * - If boolean and false, create object from the current users language - * - If boolean and true, create object from the wikis content language - * - If language object, use it as given - * @param bool $isFullKey specifies whether $key is a two part key - * "msg/lang". + * - If string and a valid code, will create a standard language object + * - If string but not a valid code, will create a basic language object + * - If boolean and false, create object from the current users language + * - If boolean and true, create object from the wikis content language + * - If language object, use it as given + * @param bool $isFullKey specifies whether $key is a two part key "msg/lang". * * @throws MWException when given an invalid key * @return string|bool False if the message doesn't exist, otherwise the @@ -1098,7 +1100,7 @@ class MessageCache { } /** - * @param $key + * @param string $key * @return array */ public function figureMessage( $key ) { @@ -1124,7 +1126,7 @@ class MessageCache { * for which MediaWiki:msgkey exists. If $code is another language code, this * will ONLY return message keys for which MediaWiki:msgkey/$code exists. * @param string $code Language code - * @return array of message keys (strings) + * @return array Array of message keys (strings) */ public function getAllMessageKeys( $code ) { global $wgContLang; diff --git a/includes/cache/ObjectFileCache.php b/includes/cache/ObjectFileCache.php index ed1e49a65d..c7ef044380 100644 --- a/includes/cache/ObjectFileCache.php +++ b/includes/cache/ObjectFileCache.php @@ -29,8 +29,8 @@ class ObjectFileCache extends FileCacheBase { /** * Construct an ObjectFileCache from a key and a type - * @param $key string - * @param $type string + * @param string $key + * @param string $type * @return ObjectFileCache */ public static function newFromKey( $key, $type ) { diff --git a/includes/cache/ResourceFileCache.php b/includes/cache/ResourceFileCache.php index 3ace3960ba..55da52c5c0 100644 --- a/includes/cache/ResourceFileCache.php +++ b/includes/cache/ResourceFileCache.php @@ -34,7 +34,7 @@ class ResourceFileCache extends FileCacheBase { /** * Construct an ResourceFileCache from a context - * @param $context ResourceLoaderContext + * @param ResourceLoaderContext $context * @return ResourceFileCache */ public static function newFromContext( ResourceLoaderContext $context ) { @@ -58,7 +58,7 @@ class ResourceFileCache extends FileCacheBase { /** * Check if an RL request can be cached. * Caller is responsible for checking if any modules are private. - * @param $context ResourceLoaderContext + * @param ResourceLoaderContext $context * @return bool */ public static function useFileCache( ResourceLoaderContext $context ) { diff --git a/includes/cache/UserCache.php b/includes/cache/UserCache.php index cea3bf2f32..7f36f5a64f 100644 --- a/includes/cache/UserCache.php +++ b/includes/cache/UserCache.php @@ -46,9 +46,9 @@ class UserCache { /** * Get a property of a user based on their user ID * - * @param $userId integer User ID + * @param int $userId User ID * @param string $prop User property - * @return mixed The property or false if the user does not exist + * @return mixed|bool The property or false if the user does not exist */ public function getProp( $userId, $prop ) { if ( !isset( $this->cache[$userId][$prop] ) ) { @@ -64,7 +64,7 @@ class UserCache { /** * Get the name of a user or return $ip if the user ID is 0 * - * @param integer $userId + * @param int $userId * @param string $ip * @return string * @since 1.22 @@ -77,7 +77,7 @@ class UserCache { * Preloads user names for given list of users. * @param array $userIds List of user IDs * @param array $options Option flags; include 'userpage' and 'usertalk' - * @param string $caller the calling method + * @param string $caller The calling method */ public function doQuery( array $userIds, $options = array(), $caller = '' ) { wfProfileIn( __METHOD__ ); @@ -140,7 +140,7 @@ class UserCache { /** * Check if a cache type is in $options and was not loaded for this user * - * @param $uid integer user ID + * @param int $uid User ID * @param string $type Cache type * @param array $options Requested cache types * @return bool diff --git a/includes/objectcache/APCBagOStuff.php b/includes/objectcache/APCBagOStuff.php index 3fb8083548..f8741cfd35 100644 --- a/includes/objectcache/APCBagOStuff.php +++ b/includes/objectcache/APCBagOStuff.php @@ -28,8 +28,8 @@ */ class APCBagOStuff extends BagOStuff { /** - * @param $key string - * @param $casToken[optional] int + * @param string $key + * @param int $casToken [optional] * @return mixed */ public function get( $key, &$casToken = null ) { @@ -49,9 +49,9 @@ class APCBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $value mixed - * @param $exptime int + * @param string $key + * @param mixed $value + * @param int $exptime * @return bool */ public function set( $key, $value, $exptime = 0 ) { @@ -65,10 +65,10 @@ class APCBagOStuff extends BagOStuff { } /** - * @param $casToken mixed - * @param $key string - * @param $value mixed - * @param $exptime int + * @param mixed $casToken + * @param string $key + * @param mixed $value + * @param int $exptime * @return bool */ public function cas( $casToken, $key, $value, $exptime = 0 ) { @@ -77,8 +77,8 @@ class APCBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $time int + * @param string $key + * @param int $time * @return bool */ public function delete( $key, $time = 0 ) { @@ -88,11 +88,11 @@ class APCBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $callback closure Callback method to be executed + * @param string $key + * @param closure $callback Callback method to be executed * @param int $exptime Either an interval in seconds or a unix timestamp for expiry * @param int $attempts The amount of times to attempt a merge in case of failure - * @return bool success + * @return bool Success */ public function merge( $key, closure $callback, $exptime = 0, $attempts = 10 ) { return $this->mergeViaLock( $key, $callback, $exptime, $attempts ); diff --git a/includes/objectcache/BagOStuff.php b/includes/objectcache/BagOStuff.php index 1b3e4bc774..05d897f1fb 100644 --- a/includes/objectcache/BagOStuff.php +++ b/includes/objectcache/BagOStuff.php @@ -52,7 +52,7 @@ abstract class BagOStuff { const ERR_UNEXPECTED = 3; // response gave some error /** - * @param $bool bool + * @param bool $bool */ public function setDebug( $bool ) { $this->debugMode = $bool; @@ -63,34 +63,34 @@ abstract class BagOStuff { /** * Get an item with the given key. Returns false if it does not exist. - * @param $key string - * @param $casToken[optional] mixed + * @param string $key + * @param mixed $casToken [optional] * @return mixed Returns false on failure */ abstract public function get( $key, &$casToken = null ); /** * Set an item. - * @param $key string - * @param $value mixed + * @param string $key + * @param mixed $value * @param int $exptime Either an interval in seconds or a unix timestamp for expiry - * @return bool success + * @return bool Success */ abstract public function set( $key, $value, $exptime = 0 ); /** * Check and set an item. - * @param $casToken mixed - * @param $key string - * @param $value mixed + * @param mixed $casToken + * @param string $key + * @param mixed $value * @param int $exptime Either an interval in seconds or a unix timestamp for expiry - * @return bool success + * @return bool Success */ abstract public function cas( $casToken, $key, $value, $exptime = 0 ); /** * Delete an item. - * @param $key string + * @param string $key * @param int $time Amount of time to delay the operation (mostly memcached-specific) * @return bool True if the item was deleted or not found, false on failure */ @@ -101,11 +101,11 @@ abstract class BagOStuff { * The callback function returns the new value given the current value (possibly false), * and takes the arguments: (this BagOStuff object, cache key, current value). * - * @param $key string - * @param $callback closure Callback method to be executed + * @param string $key + * @param closure $callback Callback method to be executed * @param int $exptime Either an interval in seconds or a unix timestamp for expiry * @param int $attempts The amount of times to attempt a merge in case of failure - * @return bool success + * @return bool Success */ public function merge( $key, closure $callback, $exptime = 0, $attempts = 10 ) { return $this->mergeViaCas( $key, $callback, $exptime, $attempts ); @@ -114,11 +114,11 @@ abstract class BagOStuff { /** * @see BagOStuff::merge() * - * @param $key string - * @param $callback closure Callback method to be executed + * @param string $key + * @param closure $callback Callback method to be executed * @param int $exptime Either an interval in seconds or a unix timestamp for expiry * @param int $attempts The amount of times to attempt a merge in case of failure - * @return bool success + * @return bool Success */ protected function mergeViaCas( $key, closure $callback, $exptime = 0, $attempts = 10 ) { do { @@ -143,11 +143,11 @@ abstract class BagOStuff { /** * @see BagOStuff::merge() * - * @param $key string - * @param $callback closure Callback method to be executed + * @param string $key + * @param closure $callback Callback method to be executed * @param int $exptime Either an interval in seconds or a unix timestamp for expiry * @param int $attempts The amount of times to attempt a merge in case of failure - * @return bool success + * @return bool Success */ protected function mergeViaLock( $key, closure $callback, $exptime = 0, $attempts = 10 ) { if ( !$this->lock( $key, 6 ) ) { @@ -172,9 +172,9 @@ abstract class BagOStuff { } /** - * @param $key string - * @param $timeout integer [optional] - * @return bool success + * @param string $key + * @param int $timeout [optional] + * @return bool Success */ public function lock( $key, $timeout = 6 ) { $this->clearLastError(); @@ -208,8 +208,8 @@ abstract class BagOStuff { } /** - * @param $key string - * @return bool success + * @param string $key + * @return bool Success */ public function unlock( $key ) { return $this->delete( "{$key}:lock" ); @@ -218,11 +218,11 @@ abstract class BagOStuff { /** * Delete all objects expiring before a certain date. * @param string $date The reference date in MW format - * @param $progressCallback callback|bool Optional, a function which will be called + * @param callback|bool $progressCallback Optional, a function which will be called * regularly during long-running operations with the percentage progress * as the first parameter. * - * @return bool on success, false if unimplemented + * @return bool Success, false if unimplemented */ public function deleteObjectsExpiringBefore( $date, $progressCallback = false ) { // stub @@ -234,7 +234,7 @@ abstract class BagOStuff { /** * Get an associative array containing the item for each of the keys that have items. * @param array $keys List of strings - * @return Array + * @return array */ public function getMulti( array $keys ) { $res = array(); @@ -248,10 +248,10 @@ abstract class BagOStuff { } /** - * @param $key string - * @param $value mixed - * @param $exptime integer - * @return bool success + * @param string $key + * @param mixed $value + * @param int $exptime + * @return bool Success */ public function add( $key, $value, $exptime = 0 ) { if ( $this->get( $key ) === false ) { @@ -261,10 +261,10 @@ abstract class BagOStuff { } /** - * @param $key string - * @param $value mixed - * @param $exptime int - * @return bool success + * @param string $key + * @param mixed $value + * @param int $exptime + * @return bool Success * @deprecated since 1.23 */ public function replace( $key, $value, $exptime = 0 ) { @@ -278,8 +278,8 @@ abstract class BagOStuff { /** * Increase stored value of $key by $value while preserving its TTL * @param string $key Key to increase - * @param $value Integer: Value to add to $key (Default 1) - * @return integer|bool New value or false on failure + * @param int $value Value to add to $key (Default 1) + * @return int|bool New value or false on failure */ public function incr( $key, $value = 1 ) { if ( !$this->lock( $key ) ) { @@ -299,9 +299,9 @@ abstract class BagOStuff { /** * Decrease stored value of $key by $value while preserving its TTL - * @param $key String - * @param $value Integer - * @return integer + * @param string $key + * @param int $value + * @return int */ public function decr( $key, $value = 1 ) { return $this->incr( $key, - $value ); @@ -309,7 +309,7 @@ abstract class BagOStuff { /** * Get the "last error" registered; clearLastError() should be called manually - * @return integer ERR_* constant for the "last error" registry + * @return int ERR_* constant for the "last error" registry * @since 1.23 */ public function getLastError() { @@ -326,7 +326,7 @@ abstract class BagOStuff { /** * Set the "last error" registry - * @param $err integer ERR_* constant + * @param int $err ERR_* constant * @since 1.23 */ protected function setLastError( $err ) { @@ -334,7 +334,7 @@ abstract class BagOStuff { } /** - * @param $text string + * @param string $text */ public function debug( $text ) { if ( $this->debugMode ) { @@ -345,7 +345,7 @@ abstract class BagOStuff { /** * Convert an optionally relative time to an absolute time - * @param $exptime integer + * @param int $exptime * @return int */ protected function convertExpiry( $exptime ) { @@ -360,8 +360,8 @@ abstract class BagOStuff { * Convert an optionally absolute expiry time to a relative time. If an * absolute time is specified which is in the past, use a short expiry time. * - * @param $exptime integer - * @return integer + * @param int $exptime + * @return int */ protected function convertToRelative( $exptime ) { if ( $exptime >= 86400 * 3650 /* 10 years */ ) { @@ -378,7 +378,7 @@ abstract class BagOStuff { /** * Check if a value is an integer * - * @param $value mixed + * @param mixed $value * @return bool */ protected function isInteger( $value ) { diff --git a/includes/objectcache/EmptyBagOStuff.php b/includes/objectcache/EmptyBagOStuff.php index 0a945a9176..3f6f6c72cd 100644 --- a/includes/objectcache/EmptyBagOStuff.php +++ b/includes/objectcache/EmptyBagOStuff.php @@ -29,8 +29,8 @@ class EmptyBagOStuff extends BagOStuff { /** - * @param $key string - * @param $casToken[optional] mixed + * @param string $key + * @param mixed $casToken [optional] * @return bool */ function get( $key, &$casToken = null ) { @@ -38,9 +38,9 @@ class EmptyBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $value mixed - * @param $exp int + * @param string $key + * @param mixed $value + * @param int $exp * @return bool */ function set( $key, $value, $exp = 0 ) { @@ -48,10 +48,10 @@ class EmptyBagOStuff extends BagOStuff { } /** - * @param $casToken mixed - * @param $key string - * @param $value mixed - * @param $exp int + * @param mixed $casToken + * @param string $key + * @param mixed $value + * @param int $exp * @return bool */ function cas( $casToken, $key, $value, $exp = 0 ) { @@ -59,8 +59,8 @@ class EmptyBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $time int + * @param string $key + * @param int $time * @return bool */ function delete( $key, $time = 0 ) { @@ -68,11 +68,11 @@ class EmptyBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $callback closure Callback method to be executed + * @param string $key + * @param closure $callback Callback method to be executed * @param int $exptime Either an interval in seconds or a unix timestamp for expiry * @param int $attempts The amount of times to attempt a merge in case of failure - * @return bool success + * @return bool Success */ public function merge( $key, closure $callback, $exptime = 0, $attempts = 10 ) { return true; diff --git a/includes/objectcache/HashBagOStuff.php b/includes/objectcache/HashBagOStuff.php index bc5167d7d3..db0e579922 100644 --- a/includes/objectcache/HashBagOStuff.php +++ b/includes/objectcache/HashBagOStuff.php @@ -35,7 +35,7 @@ class HashBagOStuff extends BagOStuff { } /** - * @param $key string + * @param string $key * @return bool */ protected function expire( $key ) { @@ -51,8 +51,8 @@ class HashBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $casToken[optional] mixed + * @param string $key + * @param mixed $casToken [optional] * @return bool|mixed */ function get( $key, &$casToken = null ) { @@ -70,9 +70,9 @@ class HashBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $value mixed - * @param $exptime int + * @param string $key + * @param mixed $value + * @param int $exptime * @return bool */ function set( $key, $value, $exptime = 0 ) { @@ -81,10 +81,10 @@ class HashBagOStuff extends BagOStuff { } /** - * @param $casToken mixed - * @param $key string - * @param $value mixed - * @param $exptime int + * @param mixed $casToken + * @param string $key + * @param mixed $value + * @param int $exptime * @return bool */ function cas( $casToken, $key, $value, $exptime = 0 ) { @@ -96,8 +96,8 @@ class HashBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $time int + * @param string $key + * @param int $time * @return bool */ function delete( $key, $time = 0 ) { diff --git a/includes/objectcache/MemcachedBagOStuff.php b/includes/objectcache/MemcachedBagOStuff.php index e4bbb430fb..79a684137e 100644 --- a/includes/objectcache/MemcachedBagOStuff.php +++ b/includes/objectcache/MemcachedBagOStuff.php @@ -32,6 +32,8 @@ class MemcachedBagOStuff extends BagOStuff { /** * Fill in the defaults for any parameters missing from $params, using the * backwards-compatible global variables + * @param array $params + * @return array */ protected function applyDefaultParams( $params ) { if ( !isset( $params['servers'] ) ) { @@ -56,18 +58,18 @@ class MemcachedBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $casToken[optional] mixed - * @return Mixed + * @param string $key + * @param mixed $casToken [optional] + * @return mixed */ public function get( $key, &$casToken = null ) { return $this->client->get( $this->encodeKey( $key ), $casToken ); } /** - * @param $key string - * @param $value - * @param $exptime int + * @param string $key + * @param mixed $value + * @param int $exptime * @return bool */ public function set( $key, $value, $exptime = 0 ) { @@ -76,10 +78,10 @@ class MemcachedBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $casToken mixed - * @param $value - * @param $exptime int + * @param string $key + * @param mixed $casToken + * @param mixed $value + * @param int $exptime * @return bool */ public function cas( $casToken, $key, $value, $exptime = 0 ) { @@ -88,8 +90,8 @@ class MemcachedBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $time int + * @param string $key + * @param int $time * @return bool */ public function delete( $key, $time = 0 ) { @@ -97,10 +99,10 @@ class MemcachedBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $value int + * @param string $key + * @param int $value * @param int $exptime (default 0) - * @return Mixed + * @return mixed */ public function add( $key, $value, $exptime = 0 ) { return $this->client->add( $this->encodeKey( $key ), $value, @@ -110,6 +112,7 @@ class MemcachedBagOStuff extends BagOStuff { /** * Get the underlying client object. This is provided for debugging * purposes. + * @return BagOStuff */ public function getClient() { return $this->client; @@ -122,7 +125,7 @@ class MemcachedBagOStuff extends BagOStuff { * the other control characters for compatibility with libmemcached * verify_key. We leave other punctuation alone, to maximise backwards * compatibility. - * @param $key string + * @param string $key * @return string */ public function encodeKey( $key ) { @@ -131,7 +134,7 @@ class MemcachedBagOStuff extends BagOStuff { } /** - * @param $m array + * @param array $m * @return string */ protected function encodeKeyCallback( $m ) { @@ -144,6 +147,8 @@ class MemcachedBagOStuff extends BagOStuff { * discarded immediately because the expiry is in the past. * Clamp expiries >30d at 30d, unless they're >=1e9 in which * case they are likely to really be absolute (1e9 = 2011-09-09) + * @param int $expiry + * @return int */ function fixExpiry( $expiry ) { if ( $expiry > 2592000 && $expiry < 1000000000 ) { @@ -156,7 +161,7 @@ class MemcachedBagOStuff extends BagOStuff { * Decode a key encoded with encodeKey(). This is provided as a convenience * function for debugging. * - * @param $key string + * @param string $key * * @return string */ @@ -166,6 +171,7 @@ class MemcachedBagOStuff extends BagOStuff { /** * Send a debug message to the log + * @param string $text */ protected function debugLog( $text ) { wfDebugLog( 'memcached', $text ); diff --git a/includes/objectcache/MemcachedClient.php b/includes/objectcache/MemcachedClient.php index d39b288aa3..bc59c6ff05 100644 --- a/includes/objectcache/MemcachedClient.php +++ b/includes/objectcache/MemcachedClient.php @@ -121,7 +121,7 @@ class MWMemcached { /** * Current debug status; 0 - none to 9 - profiling * - * @var boolean + * @var bool * @access private */ var $_debug; @@ -137,7 +137,7 @@ class MWMemcached { /** * Is compression available? * - * @var boolean + * @var bool * @access private */ var $_have_zlib; @@ -145,7 +145,7 @@ class MWMemcached { /** * Do we want to use compression? * - * @var boolean + * @var bool * @access private */ var $_compress_enable; @@ -153,7 +153,7 @@ class MWMemcached { /** * At how many bytes should we compress? * - * @var integer + * @var int * @access private */ var $_compress_threshold; @@ -161,7 +161,7 @@ class MWMemcached { /** * Are we using persistent links? * - * @var boolean + * @var bool * @access private */ var $_persistent; @@ -193,7 +193,7 @@ class MWMemcached { /** * Total # of bit buckets we have * - * @var integer + * @var int * @access private */ var $_bucketcount; @@ -201,7 +201,7 @@ class MWMemcached { /** * # of total servers we have * - * @var integer + * @var int * @access private */ var $_active; @@ -209,7 +209,7 @@ class MWMemcached { /** * Stream timeout in seconds. Applies for example to fread() * - * @var integer + * @var int * @access private */ var $_timeout_seconds; @@ -217,7 +217,7 @@ class MWMemcached { /** * Stream timeout in microseconds * - * @var integer + * @var int * @access private */ var $_timeout_microseconds; @@ -271,15 +271,15 @@ class MWMemcached { * Adds a key/value to the memcache server if one isn't already set with * that key * - * @param string $key key to set with data - * @param $val Mixed: value to store - * @param $exp Integer: (optional) Expiration time. This can be a number of seconds + * @param string $key Key to set with data + * @param mixed $val Value to store + * @param int $exp (optional) Expiration time. This can be a number of seconds * to cache for (up to 30 days inclusive). Any timespans of 30 days + 1 second or * longer must be the timestamp of the time at which the mapping should expire. It * is safe to use timestamps in all cases, regardless of expiration * eg: strtotime("+3 hour") * - * @return Boolean + * @return bool */ public function add( $key, $val, $exp = 0 ) { return $this->_set( 'add', $key, $val, $exp ); @@ -291,10 +291,10 @@ class MWMemcached { /** * Decrease a value stored on the memcache server * - * @param string $key key to decrease - * @param $amt Integer: (optional) amount to decrease + * @param string $key Key to decrease + * @param int $amt (optional) amount to decrease * - * @return Mixed: FALSE on failure, value on success + * @return mixed False on failure, value on success */ public function decr( $key, $amt = 1 ) { return $this->_incrdecr( 'decr', $key, $amt ); @@ -306,10 +306,10 @@ class MWMemcached { /** * Deletes a key from the server, optionally after $time * - * @param string $key key to delete - * @param $time Integer: (optional) how long to wait before deleting + * @param string $key Key to delete + * @param int $time (optional) how long to wait before deleting * - * @return Boolean: TRUE on success, FALSE on failure + * @return bool True on success, false on failure */ public function delete( $key, $time = 0 ) { if ( !$this->_active ) { @@ -346,8 +346,8 @@ class MWMemcached { } /** - * @param $key - * @param $timeout int + * @param string $key + * @param int $timeout * @return bool */ public function lock( $key, $timeout = 0 ) { @@ -356,7 +356,7 @@ class MWMemcached { } /** - * @param $key + * @param string $key * @return bool */ public function unlock( $key ) { @@ -384,7 +384,7 @@ class MWMemcached { /** * Enable / Disable compression * - * @param $enable Boolean: TRUE to enable, FALSE to disable + * @param bool $enable True to enable, false to disable */ public function enable_compress( $enable ) { $this->_compress_enable = $enable; @@ -407,9 +407,9 @@ class MWMemcached { * Retrieves the value associated with the key from the memcache server * * @param array|string $key key to retrieve - * @param $casToken[optional] Float + * @param float $casToken [optional] * - * @return Mixed + * @return mixed */ public function get( $key, &$casToken = null ) { wfProfileIn( __METHOD__ ); @@ -466,9 +466,9 @@ class MWMemcached { /** * Get multiple keys from the server(s) * - * @param array $keys keys to retrieve + * @param array $keys Keys to retrieve * - * @return Array + * @return array */ public function get_multi( $keys ) { if ( !$this->_active ) { @@ -530,10 +530,10 @@ class MWMemcached { /** * Increments $key (optionally) by $amt * - * @param string $key key to increment - * @param $amt Integer: (optional) amount to increment + * @param string $key Key to increment + * @param int $amt (optional) amount to increment * - * @return Integer: null if the key does not exist yet (this does NOT + * @return int|null Null if the key does not exist yet (this does NOT * create new mappings if the key does not exist). If the key does * exist, this returns the new value for that key. */ @@ -547,15 +547,15 @@ class MWMemcached { /** * Overwrites an existing value for key; only works if key is already set * - * @param string $key key to set value as - * @param $value Mixed: value to store - * @param $exp Integer: (optional) Expiration time. This can be a number of seconds + * @param string $key Key to set value as + * @param mixed $value Value to store + * @param int $exp (optional) Expiration time. This can be a number of seconds * to cache for (up to 30 days inclusive). Any timespans of 30 days + 1 second or * longer must be the timestamp of the time at which the mapping should expire. It * is safe to use timestamps in all cases, regardless of exipration * eg: strtotime("+3 hour") * - * @return Boolean + * @return bool */ public function replace( $key, $value, $exp = 0 ) { return $this->_set( 'replace', $key, $value, $exp ); @@ -568,10 +568,10 @@ class MWMemcached { * Passes through $cmd to the memcache server connected by $sock; returns * output as an array (null array if no output) * - * @param $sock Resource: socket to send command on - * @param string $cmd command to run + * @param Resource $sock Socket to send command on + * @param string $cmd Command to run * - * @return Array: output array + * @return array Output array */ public function run_command( $sock, $cmd ) { if ( !is_resource( $sock ) ) { @@ -603,15 +603,15 @@ class MWMemcached { * Unconditionally sets a key to a given value in the memcache. Returns true * if set successfully. * - * @param string $key key to set value as - * @param $value Mixed: value to set - * @param $exp Integer: (optional) Expiration time. This can be a number of seconds + * @param string $key Key to set value as + * @param mixed $value Value to set + * @param int $exp (optional) Expiration time. This can be a number of seconds * to cache for (up to 30 days inclusive). Any timespans of 30 days + 1 second or * longer must be the timestamp of the time at which the mapping should expire. It * is safe to use timestamps in all cases, regardless of exipration * eg: strtotime("+3 hour") * - * @return Boolean: TRUE on success + * @return bool True on success */ public function set( $key, $value, $exp = 0 ) { return $this->_set( 'set', $key, $value, $exp ); @@ -624,16 +624,16 @@ class MWMemcached { * Sets a key to a given value in the memcache if the current value still corresponds * to a known, given value. Returns true if set successfully. * - * @param $casToken Float: current known value - * @param string $key key to set value as - * @param $value Mixed: value to set - * @param $exp Integer: (optional) Expiration time. This can be a number of seconds + * @param float $casToken Current known value + * @param string $key Key to set value as + * @param mixed $value Value to set + * @param int $exp (optional) Expiration time. This can be a number of seconds * to cache for (up to 30 days inclusive). Any timespans of 30 days + 1 second or * longer must be the timestamp of the time at which the mapping should expire. It * is safe to use timestamps in all cases, regardless of exipration * eg: strtotime("+3 hour") * - * @return Boolean: TRUE on success + * @return bool True on success */ public function cas( $casToken, $key, $value, $exp = 0 ) { return $this->_set( 'cas', $key, $value, $exp, $casToken ); @@ -645,7 +645,7 @@ class MWMemcached { /** * Sets the compression threshold * - * @param $thresh Integer: threshold to compress if larger than + * @param int $thresh Threshold to compress if larger than */ public function set_compress_threshold( $thresh ) { $this->_compress_threshold = $thresh; @@ -657,9 +657,9 @@ class MWMemcached { /** * Sets the debug flag * - * @param $dbg Boolean: TRUE for debugging, FALSE otherwise + * @param bool $dbg True for debugging, false otherwise * - * @see MWMemcached::__construct + * @see MWMemcached::__construct */ public function set_debug( $dbg ) { $this->_debug = $dbg; @@ -671,9 +671,9 @@ class MWMemcached { /** * Sets the server list to distribute key gets and puts between * - * @param array $list of servers to connect to + * @param array $list Array of servers to connect to * - * @see MWMemcached::__construct() + * @see MWMemcached::__construct() */ public function set_servers( $list ) { $this->_servers = $list; @@ -690,8 +690,8 @@ class MWMemcached { /** * Sets the timeout for new connections * - * @param $seconds Integer: number of seconds - * @param $microseconds Integer: number of microseconds + * @param int $seconds Number of seconds + * @param int $microseconds Number of microseconds */ public function set_timeout( $seconds, $microseconds ) { $this->_timeout_seconds = $seconds; @@ -706,7 +706,7 @@ class MWMemcached { /** * Close the specified socket * - * @param string $sock socket to close + * @param string $sock Socket to close * * @access private */ @@ -722,10 +722,10 @@ class MWMemcached { /** * Connects $sock to $host, timing out after $timeout * - * @param $sock Integer: socket to connect + * @param int $sock Socket to connect * @param string $host Host:IP to connect to * - * @return boolean + * @return bool * @access private */ function _connect_sock( &$sock, $host ) { @@ -765,7 +765,7 @@ class MWMemcached { /** * Marks a host as dead until 30-40 seconds in the future * - * @param string $sock socket to mark as dead + * @param string $sock Socket to mark as dead * * @access private */ @@ -775,7 +775,7 @@ class MWMemcached { } /** - * @param $host + * @param string $host */ function _dead_host( $host ) { $parts = explode( ':', $host ); @@ -791,9 +791,9 @@ class MWMemcached { /** * get_sock * - * @param string $key key to retrieve value for; + * @param string $key Key to retrieve value for; * - * @return Mixed: resource on success, false on failure + * @return Resource|bool Resource on success, false on failure * @access private */ function get_sock( $key ) { @@ -840,9 +840,9 @@ class MWMemcached { /** * Creates a hash integer based on the $key * - * @param string $key key to hash + * @param string $key Key to hash * - * @return Integer: hash value + * @return int Hash value * @access private */ function _hashfunc( $key ) { @@ -858,11 +858,11 @@ class MWMemcached { /** * Perform increment/decriment on $key * - * @param string $cmd command to perform - * @param string|array $key key to perform it on - * @param $amt Integer amount to adjust + * @param string $cmd Command to perform + * @param string|array $key Key to perform it on + * @param int $amt Amount to adjust * - * @return Integer: new value of $key + * @return int New value of $key * @access private */ function _incrdecr( $cmd, $key, $amt = 1 ) { @@ -899,10 +899,10 @@ class MWMemcached { /** * Load items into $ret from $sock * - * @param $sock Resource: socket to read from + * @param Resource $sock Socket to read from * @param array $ret returned values - * @param $casToken[optional] Float - * @return boolean True for success, false for failure + * @param float $casToken [optional] + * @return bool True for success, false for failure * * @access private */ @@ -985,17 +985,17 @@ class MWMemcached { /** * Performs the requested storage operation to the memcache server * - * @param string $cmd command to perform - * @param string $key key to act on - * @param $val Mixed: what we need to store - * @param $exp Integer: (optional) Expiration time. This can be a number of seconds + * @param string $cmd Command to perform + * @param string $key Key to act on + * @param mixed $val What we need to store + * @param int $exp (optional) Expiration time. This can be a number of seconds * to cache for (up to 30 days inclusive). Any timespans of 30 days + 1 second or * longer must be the timestamp of the time at which the mapping should expire. It * is safe to use timestamps in all cases, regardless of exipration * eg: strtotime("+3 hour") - * @param $casToken[optional] Float + * @param float $casToken [optional] * - * @return Boolean + * @return bool * @access private */ function _set( $cmd, $key, $val, $exp, $casToken = null ) { @@ -1070,7 +1070,7 @@ class MWMemcached { * * @param string $host Host:IP to get socket for * - * @return Mixed: IO Stream or false + * @return Resource|bool IO Stream or false * @access private */ function sock_to_host( $host ) { @@ -1100,14 +1100,14 @@ class MWMemcached { } /** - * @param $text string + * @param string $text */ function _debugprint( $text ) { wfDebugLog( 'memcached', $text ); } /** - * @param $text string + * @param string $text */ function _error_log( $text ) { wfDebugLog( 'memcached-serious', "Memcached error: $text" ); @@ -1116,8 +1116,8 @@ class MWMemcached { /** * Write to a stream. If there is an error, mark the socket dead. * - * @param $sock The socket - * @param $buf The string to write + * @param Resource $sock The socket + * @param string $buf The string to write * @return bool True on success, false on failure */ function _fwrite( $sock, $buf ) { @@ -1143,6 +1143,9 @@ class MWMemcached { /** * Handle an I/O error. Mark the socket dead and log an error. + * + * @param Resource $sock + * @param string $msg */ function _handle_error( $sock, $msg ) { $peer = stream_socket_get_name( $sock, true /** remote **/ ); @@ -1161,9 +1164,9 @@ class MWMemcached { * Read the specified number of bytes from a stream. If there is an error, * mark the socket dead. * - * @param $sock The socket - * @param $len The number of bytes to read - * @return The string on success, false on failure. + * @param Resource $sock The socket + * @param int $len The number of bytes to read + * @return string|bool The string on success, false on failure. */ function _fread( $sock, $len ) { $buf = ''; @@ -1193,8 +1196,8 @@ class MWMemcached { * Read a line from a stream. If there is an error, mark the socket dead. * The \r\n line ending is stripped from the response. * - * @param $sock The socket - * @return The string on success, false on failure + * @param Resource $sock The socket + * @return string|bool The string on success, false on failure */ function _fgets( $sock ) { $result = fgets( $sock ); @@ -1223,7 +1226,7 @@ class MWMemcached { /** * Flush the read buffer of a stream - * @param $f Resource + * @param Resource $f */ function _flush_read_buffer( $f ) { if ( !is_resource( $f ) ) { diff --git a/includes/objectcache/MemcachedPeclBagOStuff.php b/includes/objectcache/MemcachedPeclBagOStuff.php index 1c780b4788..5a96f7b48c 100644 --- a/includes/objectcache/MemcachedPeclBagOStuff.php +++ b/includes/objectcache/MemcachedPeclBagOStuff.php @@ -42,6 +42,7 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { * - serializer: May be either "php" or "igbinary". Igbinary produces more compact * values, but serialization is much slower unless the php.ini option * igbinary.compact_strings is off. + * @param array $params */ function __construct( $params ) { $params = $this->applyDefaultParams( $params ); @@ -113,9 +114,9 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { } /** - * @param $key string - * @param $casToken[optional] float - * @return Mixed + * @param string $key + * @param float $casToken [optional] + * @return mixed */ public function get( $key, &$casToken = null ) { wfProfileIn( __METHOD__ ); @@ -127,9 +128,9 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { } /** - * @param $key string - * @param $value - * @param $exptime int + * @param string $key + * @param mixed $value + * @param int $exptime * @return bool */ public function set( $key, $value, $exptime = 0 ) { @@ -138,10 +139,10 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { } /** - * @param $casToken float - * @param $key string - * @param $value - * @param $exptime int + * @param float $casToken + * @param string $key + * @param mixed $value + * @param int $exptime * @return bool */ public function cas( $casToken, $key, $value, $exptime = 0 ) { @@ -150,8 +151,8 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { } /** - * @param $key string - * @param $time int + * @param string $key + * @param int $time * @return bool */ public function delete( $key, $time = 0 ) { @@ -166,10 +167,10 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { } /** - * @param $key string - * @param $value int - * @param $exptime int - * @return Mixed + * @param string $key + * @param int $value + * @param int $exptime + * @return mixed */ public function add( $key, $value, $exptime = 0 ) { $this->debugLog( "add($key)" ); @@ -177,9 +178,9 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { } /** - * @param $key string - * @param $value int - * @return Mixed + * @param string $key + * @param int $value + * @return mixed */ public function incr( $key, $value = 1 ) { $this->debugLog( "incr($key)" ); @@ -188,9 +189,9 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { } /** - * @param $key string - * @param $value int - * @return Mixed + * @param string $key + * @param int $value + * @return mixed */ public function decr( $key, $value = 1 ) { $this->debugLog( "decr($key)" ); @@ -206,8 +207,8 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { * different. * * @param string $key The key used by the caller, or false if there wasn't one. - * @param $result Mixed The return value - * @return Mixed + * @param mixed $result The return value + * @return mixed */ protected function checkResult( $key, $result ) { if ( $result !== false ) { @@ -237,8 +238,8 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { } /** - * @param $keys Array - * @return Array + * @param array $keys + * @return array */ public function getMulti( array $keys ) { wfProfileIn( __METHOD__ ); diff --git a/includes/objectcache/MemcachedPhpBagOStuff.php b/includes/objectcache/MemcachedPhpBagOStuff.php index 33a134c774..330d2b52ad 100644 --- a/includes/objectcache/MemcachedPhpBagOStuff.php +++ b/includes/objectcache/MemcachedPhpBagOStuff.php @@ -39,7 +39,7 @@ class MemcachedPhpBagOStuff extends MemcachedBagOStuff { * - timeout: The read timeout in microseconds * - connect_timeout: The connect timeout in seconds * - * @param $params array + * @param array $params */ function __construct( $params ) { $params = $this->applyDefaultParams( $params ); @@ -50,15 +50,15 @@ class MemcachedPhpBagOStuff extends MemcachedBagOStuff { } /** - * @param $debug bool + * @param bool $debug */ public function setDebug( $debug ) { $this->client->set_debug( $debug ); } /** - * @param $keys Array - * @return Array + * @param array $keys + * @return array */ public function getMulti( array $keys ) { $callback = array( $this, 'encodeKey' ); @@ -66,8 +66,8 @@ class MemcachedPhpBagOStuff extends MemcachedBagOStuff { } /** - * @param $key - * @param $timeout int + * @param string $key + * @param int $timeout * @return bool */ public function lock( $key, $timeout = 0 ) { @@ -75,26 +75,26 @@ class MemcachedPhpBagOStuff extends MemcachedBagOStuff { } /** - * @param $key string - * @return Mixed + * @param string $key + * @return mixed */ public function unlock( $key ) { return $this->client->unlock( $this->encodeKey( $key ) ); } /** - * @param $key string - * @param $value int - * @return Mixed + * @param string $key + * @param int $value + * @return mixed */ public function incr( $key, $value = 1 ) { return $this->client->incr( $this->encodeKey( $key ), $value ); } /** - * @param $key string - * @param $value int - * @return Mixed + * @param string $key + * @param int $value + * @return mixed */ public function decr( $key, $value = 1 ) { return $this->client->decr( $this->encodeKey( $key ), $value ); diff --git a/includes/objectcache/MultiWriteBagOStuff.php b/includes/objectcache/MultiWriteBagOStuff.php index b97410a5cc..a1290f80d2 100644 --- a/includes/objectcache/MultiWriteBagOStuff.php +++ b/includes/objectcache/MultiWriteBagOStuff.php @@ -38,7 +38,7 @@ class MultiWriteBagOStuff extends BagOStuff { * structures, in the style required by $wgObjectCaches. See * the documentation of $wgObjectCaches for more detail. * - * @param $params array + * @param array $params * @throws MWException */ public function __construct( $params ) { @@ -53,15 +53,15 @@ class MultiWriteBagOStuff extends BagOStuff { } /** - * @param $debug bool + * @param bool $debug */ public function setDebug( $debug ) { $this->doWrite( 'setDebug', $debug ); } /** - * @param $key string - * @param $casToken[optional] mixed + * @param string $key + * @param mixed $casToken [optional] * @return bool|mixed */ public function get( $key, &$casToken = null ) { @@ -75,10 +75,10 @@ class MultiWriteBagOStuff extends BagOStuff { } /** - * @param $casToken mixed - * @param $key string - * @param $value mixed - * @param $exptime int + * @param mixed $casToken + * @param string $key + * @param mixed $value + * @param mixed $exptime * @return bool */ public function cas( $casToken, $key, $value, $exptime = 0 ) { @@ -86,9 +86,9 @@ class MultiWriteBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $value mixed - * @param $exptime int + * @param string $key + * @param mixed $value + * @param int $exptime * @return bool */ public function set( $key, $value, $exptime = 0 ) { @@ -96,8 +96,8 @@ class MultiWriteBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $time int + * @param string $key + * @param int $time * @return bool */ public function delete( $key, $time = 0 ) { @@ -105,9 +105,9 @@ class MultiWriteBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $value mixed - * @param $exptime int + * @param string $key + * @param mixed $value + * @param int $exptime * @return bool */ public function add( $key, $value, $exptime = 0 ) { @@ -115,9 +115,9 @@ class MultiWriteBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $value mixed - * @param $exptime int + * @param string $key + * @param mixed $value + * @param int $exptime * @return bool */ public function replace( $key, $value, $exptime = 0 ) { @@ -125,8 +125,8 @@ class MultiWriteBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $value int + * @param string $key + * @param int $value * @return bool|null */ public function incr( $key, $value = 1 ) { @@ -134,8 +134,8 @@ class MultiWriteBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $value int + * @param string $key + * @param int $value * @return bool */ public function decr( $key, $value = 1 ) { @@ -143,8 +143,8 @@ class MultiWriteBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $timeout int + * @param string $key + * @param int $timeout * @return bool */ public function lock( $key, $timeout = 0 ) { @@ -157,7 +157,7 @@ class MultiWriteBagOStuff extends BagOStuff { } /** - * @param $key string + * @param string $key * @return bool */ public function unlock( $key ) { @@ -169,11 +169,11 @@ class MultiWriteBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $callback closure Callback method to be executed + * @param string $key + * @param closure $callback Callback method to be executed * @param int $exptime Either an interval in seconds or a unix timestamp for expiry * @param int $attempts The amount of times to attempt a merge in case of failure - * @return bool success + * @return bool Success */ public function merge( $key, closure $callback, $exptime = 0, $attempts = 10 ) { return $this->doWrite( 'merge', $key, $callback, $exptime ); @@ -190,7 +190,7 @@ class MultiWriteBagOStuff extends BagOStuff { } /** - * @param $method string + * @param string $method * @return bool */ protected function doWrite( $method /*, ... */ ) { @@ -210,8 +210,8 @@ class MultiWriteBagOStuff extends BagOStuff { * Delete objects expiring before a certain date. * * Succeed if any of the child caches succeed. - * @param $date string - * @param $progressCallback bool|callback + * @param string $date + * @param bool|callback $progressCallback * @return bool */ public function deleteObjectsExpiringBefore( $date, $progressCallback = false ) { diff --git a/includes/objectcache/ObjectCache.php b/includes/objectcache/ObjectCache.php index 6c1433a992..3be251ceb4 100644 --- a/includes/objectcache/ObjectCache.php +++ b/includes/objectcache/ObjectCache.php @@ -32,7 +32,7 @@ class ObjectCache { /** * Get a cached instance of the specified type of cache object. * - * @param $id string + * @param string $id * * @return BagOStuff */ @@ -56,7 +56,7 @@ class ObjectCache { /** * Create a new cache object of the specified type. * - * @param $id string + * @param string $id * * @throws MWException * @return BagOStuff @@ -75,7 +75,7 @@ class ObjectCache { /** * Create a new cache object from parameters * - * @param $params array + * @param array $params * * @throws MWException * @return BagOStuff @@ -101,7 +101,7 @@ class ObjectCache { * be an alias to the configured cache choice for that. * If no cache choice is configured (by default $wgMainCacheType is CACHE_NONE), * then CACHE_ANYTHING will forward to CACHE_DB. - * @param $params array + * @param array $params * @return BagOStuff */ static function newAnything( $params ) { @@ -118,7 +118,7 @@ class ObjectCache { /** * Factory function referenced from DefaultSettings.php for CACHE_ACCEL. * - * @param $params array + * @param array $params * @throws MWException * @return BagOStuff */ @@ -143,7 +143,7 @@ class ObjectCache { * hashing scheme and a different interpretation of the flags bitfield, so * switching between the two clients randomly would be disastrous. * - * @param $params array + * @param array $params * * @return MemcachedPhpBagOStuff */ diff --git a/includes/objectcache/ObjectCacheSessionHandler.php b/includes/objectcache/ObjectCacheSessionHandler.php index 7cf960e7d0..cdf8da1eaa 100644 --- a/includes/objectcache/ObjectCacheSessionHandler.php +++ b/includes/objectcache/ObjectCacheSessionHandler.php @@ -49,6 +49,7 @@ class ObjectCacheSessionHandler { /** * Get the cache storage object to use for session storage + * @return ObjectCache */ static function getCache() { global $wgSessionCacheType; @@ -58,8 +59,8 @@ class ObjectCacheSessionHandler { /** * Get a cache key for the given session id. * - * @param string $id session id - * @return String: cache key + * @param string $id Session id + * @return string Cache key */ static function getKey( $id ) { return wfMemcKey( 'session', $id ); @@ -68,9 +69,9 @@ class ObjectCacheSessionHandler { /** * Callback when opening a session. * - * @param $save_path String: path used to store session files, unused - * @param $session_name String: session name - * @return Boolean: success + * @param string $save_path Path used to store session files, unused + * @param string $session_name Session name + * @return bool Success */ static function open( $save_path, $session_name ) { return true; @@ -80,7 +81,7 @@ class ObjectCacheSessionHandler { * Callback when closing a session. * NOP. * - * @return Boolean: success + * @return bool Success */ static function close() { return true; @@ -89,8 +90,8 @@ class ObjectCacheSessionHandler { /** * Callback when reading session data. * - * @param string $id session id - * @return Mixed: session data + * @param string $id Session id + * @return mixed Session data */ static function read( $id ) { $data = self::getCache()->get( self::getKey( $id ) ); @@ -103,9 +104,9 @@ class ObjectCacheSessionHandler { /** * Callback when writing session data. * - * @param string $id session id - * @param $data Mixed: session data - * @return Boolean: success + * @param string $id Session id + * @param mixed $data Session data + * @return bool Success */ static function write( $id, $data ) { global $wgObjectCacheSessionExpiry; @@ -116,8 +117,8 @@ class ObjectCacheSessionHandler { /** * Callback to destroy a session when calling session_destroy(). * - * @param string $id session id - * @return Boolean: success + * @param string $id Session id + * @return bool Success */ static function destroy( $id ) { self::getCache()->delete( self::getKey( $id ) ); @@ -128,8 +129,8 @@ class ObjectCacheSessionHandler { * Callback to execute garbage collection. * NOP: Object caches perform garbage collection implicitly * - * @param $maxlifetime Integer: maximum session life time - * @return Boolean: success + * @param int $maxlifetime Maximum session life time + * @return bool Success */ static function gc( $maxlifetime ) { return true; diff --git a/includes/objectcache/RedisBagOStuff.php b/includes/objectcache/RedisBagOStuff.php index 872af638ae..d6d49ae582 100644 --- a/includes/objectcache/RedisBagOStuff.php +++ b/includes/objectcache/RedisBagOStuff.php @@ -23,7 +23,7 @@ class RedisBagOStuff extends BagOStuff { /** @var RedisConnectionPool */ protected $redisPool; - /** @var Array List of server names */ + /** @var array List of server names */ protected $servers; /** @var bool */ protected $automaticFailover; @@ -53,6 +53,7 @@ class RedisBagOStuff extends BagOStuff { * consistent hashing algorithm). True by default. This has the * potential to create consistency issues if a server is slow enough to * flap, for example if it is in swap death. + * @param array $params */ function __construct( $params ) { $redisConf = array( 'serializer' => 'none' ); // manage that in this class @@ -244,6 +245,9 @@ class RedisBagOStuff extends BagOStuff { * command. But we are constrained by the memcached-like interface to * return null in that case. Once the key exists, further increments are * atomic. + * @param string $key + * @param int $value + * @param bool|mixed */ public function incr( $key, $value = 1 ) { $section = new ProfileSection( __METHOD__ ); @@ -286,7 +290,7 @@ class RedisBagOStuff extends BagOStuff { /** * Get a Redis object with a connection suitable for fetching the specified key - * @return Array (server, RedisConnRef) or (false, false) + * @return array (server, RedisConnRef) or (false, false) */ protected function getConnection( $key ) { if ( count( $this->servers ) === 1 ) { @@ -311,6 +315,7 @@ class RedisBagOStuff extends BagOStuff { /** * Log a fatal error + * @param string $msg */ protected function logError( $msg ) { wfDebugLog( 'redis', "Redis error: $msg" ); @@ -321,6 +326,8 @@ class RedisBagOStuff extends BagOStuff { * and protocol errors. Sometimes it also closes the connection, sometimes * not. The safest response for us is to explicitly destroy the connection * object and let it be reopened during the next request. + * @param RedisConnRef $conn + * @param Exception $e */ protected function handleException( RedisConnRef $conn, $e ) { $this->setLastError( BagOStuff::ERR_UNEXPECTED ); @@ -329,6 +336,10 @@ class RedisBagOStuff extends BagOStuff { /** * Send information about a single request to the debug log + * @param string $method + * @param string $key + * @param string $server + * @param bool $result */ public function logRequest( $method, $key, $server, $result ) { $this->debug( "$method $key on $server: " . diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index 74b5de259e..4a1e2c947b 100644 --- a/includes/objectcache/SqlBagOStuff.php +++ b/includes/objectcache/SqlBagOStuff.php @@ -70,7 +70,7 @@ class SqlBagOStuff extends BagOStuff { * distributed across all tables by key hash. This is for * MySQL bugs 61735 and 61736. * - * @param $params array + * @param array $params */ public function __construct( $params ) { if ( isset( $params['servers'] ) ) { @@ -101,7 +101,7 @@ class SqlBagOStuff extends BagOStuff { /** * Get a connection to the specified database * - * @param $serverIndex integer + * @param int $serverIndex * @return DatabaseBase */ protected function getDB( $serverIndex ) { @@ -155,8 +155,8 @@ class SqlBagOStuff extends BagOStuff { /** * Get the server index and table name for a given key - * @param $key string - * @return Array: server index and table name + * @param string $key + * @return array Server index and table name */ protected function getTableByKey( $key ) { if ( $this->shards > 1 ) { @@ -178,7 +178,7 @@ class SqlBagOStuff extends BagOStuff { /** * Get the table name for a given shard index - * @param $index int + * @param int $index * @return string */ protected function getTableNameByShard( $index ) { @@ -192,8 +192,8 @@ class SqlBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $casToken[optional] mixed + * @param string $key + * @param mixed $casToken [optional] * @return mixed */ public function get( $key, &$casToken = null ) { @@ -206,8 +206,8 @@ class SqlBagOStuff extends BagOStuff { } /** - * @param $keys array - * @return Array + * @param array $keys + * @return array */ public function getMulti( array $keys ) { $values = array(); // array of (key => value) @@ -272,9 +272,9 @@ class SqlBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $value mixed - * @param $exptime int + * @param string $key + * @param mixed $value + * @param int $exptime * @return bool */ public function set( $key, $value, $exptime = 0 ) { @@ -317,10 +317,10 @@ class SqlBagOStuff extends BagOStuff { } /** - * @param $casToken mixed - * @param $key string - * @param $value mixed - * @param $exptime int + * @param mixed $casToken + * @param string $key + * @param mixed $value + * @param int $exptime * @return bool */ public function cas( $casToken, $key, $value, $exptime = 0 ) { @@ -368,8 +368,8 @@ class SqlBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $time int + * @param string $key + * @param int $time * @return bool */ public function delete( $key, $time = 0 ) { @@ -391,8 +391,8 @@ class SqlBagOStuff extends BagOStuff { } /** - * @param $key string - * @param $step int + * @param string $key + * @param int $step * @return int|null */ public function incr( $key, $step = 1 ) { @@ -444,7 +444,7 @@ class SqlBagOStuff extends BagOStuff { } /** - * @param $exptime string + * @param string $exptime * @return bool */ protected function isExpired( $db, $exptime ) { @@ -452,6 +452,7 @@ class SqlBagOStuff extends BagOStuff { } /** + * @param DatabaseBase $db * @return string */ protected function getMaxDateTime( $db ) { @@ -485,8 +486,8 @@ class SqlBagOStuff extends BagOStuff { /** * Delete objects from the database which expire before a certain date. - * @param $timestamp string - * @param $progressCallback bool|callback + * @param string $timestamp + * @param bool|callback $progressCallback * @return bool */ public function deleteObjectsExpiringBefore( $timestamp, $progressCallback = false ) { @@ -583,7 +584,7 @@ class SqlBagOStuff extends BagOStuff { * On typical message and page data, this can provide a 3X decrease * in storage requirements. * - * @param $data mixed + * @param mixed $data * @return string */ protected function serialize( &$data ) { @@ -598,7 +599,7 @@ class SqlBagOStuff extends BagOStuff { /** * Unserialize and, if necessary, decompress an object. - * @param $serial string + * @param string $serial * @return mixed */ protected function unserialize( $serial ) { @@ -619,6 +620,9 @@ class SqlBagOStuff extends BagOStuff { /** * Handle a DBError which occurred during a read operation. + * + * @param DBError $exception + * @param int $serverIndex */ protected function handleReadError( DBError $exception, $serverIndex ) { if ( $exception instanceof DBConnectionError ) { @@ -636,6 +640,9 @@ class SqlBagOStuff extends BagOStuff { /** * Handle a DBQueryError which occurred during a write operation. + * + * @param DBError $exception + * @param int $serverIndex */ protected function handleWriteError( DBError $exception, $serverIndex ) { if ( $exception instanceof DBConnectionError ) { @@ -658,6 +665,9 @@ class SqlBagOStuff extends BagOStuff { /** * Mark a server down due to a DBConnectionError exception + * + * @param DBError $exception + * @param int $serverIndex */ protected function markServerDown( $exception, $serverIndex ) { if ( isset( $this->connFailureTimes[$serverIndex] ) ) { diff --git a/includes/objectcache/WinCacheBagOStuff.php b/includes/objectcache/WinCacheBagOStuff.php index 6d9b47ad63..a6c7d9ca90 100644 --- a/includes/objectcache/WinCacheBagOStuff.php +++ b/includes/objectcache/WinCacheBagOStuff.php @@ -32,8 +32,8 @@ class WinCacheBagOStuff extends BagOStuff { /** * Get a value from the WinCache object cache * - * @param string $key cache key - * @param $casToken[optional] int: cas token + * @param string $key Cache key + * @param int $casToken [optional] Cas token * @return mixed */ public function get( $key, &$casToken = null ) { @@ -51,9 +51,9 @@ class WinCacheBagOStuff extends BagOStuff { /** * Store a value in the WinCache object cache * - * @param string $key cache key - * @param $value Mixed: object to store - * @param int $expire expiration time + * @param string $key Cache key + * @param mixed $valueObject to store + * @param int $expire Expiration time * @return bool */ public function set( $key, $value, $expire = 0 ) { @@ -67,10 +67,10 @@ class WinCacheBagOStuff extends BagOStuff { /** * Store a value in the WinCache object cache, race condition-safe * - * @param int $casToken cas token - * @param string $key cache key - * @param int $value object to store - * @param int $exptime expiration time + * @param int $casToken Cas token + * @param string $key Cache key + * @param int $value Object to store + * @param int $exptime Expiration time * @return bool */ public function cas( $casToken, $key, $value, $exptime = 0 ) { @@ -80,8 +80,8 @@ class WinCacheBagOStuff extends BagOStuff { /** * Remove a value from the WinCache object cache * - * @param string $key cache key - * @param int $time not used in this implementation + * @param string $key Cache key + * @param int $time Not used in this implementation * @return bool */ public function delete( $key, $time = 0 ) { diff --git a/includes/objectcache/XCacheBagOStuff.php b/includes/objectcache/XCacheBagOStuff.php index 0f45db7348..078f6d4ae5 100644 --- a/includes/objectcache/XCacheBagOStuff.php +++ b/includes/objectcache/XCacheBagOStuff.php @@ -31,8 +31,8 @@ class XCacheBagOStuff extends BagOStuff { /** * Get a value from the XCache object cache * - * @param string $key cache key - * @param $casToken mixed: cas token + * @param string $key Cache key + * @param mixed $casToken Cas token * @return mixed */ public function get( $key, &$casToken = null ) { @@ -54,9 +54,9 @@ class XCacheBagOStuff extends BagOStuff { /** * Store a value in the XCache object cache * - * @param string $key cache key - * @param $value Mixed: object to store - * @param int $expire expiration time + * @param string $key Cache key + * @param mixed $value Object to store + * @param int $expire Expiration time * @return bool */ public function set( $key, $value, $expire = 0 ) { @@ -69,10 +69,10 @@ class XCacheBagOStuff extends BagOStuff { } /** - * @param $casToken mixed - * @param $key string - * @param $value mixed - * @param $exptime int + * @param mixed $casToken + * @param string $key + * @param mixed $value + * @param int $exptime * @return bool */ public function cas( $casToken, $key, $value, $exptime = 0 ) { @@ -83,8 +83,8 @@ class XCacheBagOStuff extends BagOStuff { /** * Remove a value from the XCache object cache * - * @param string $key cache key - * @param int $time not used in this implementation + * @param string $key Cache key + * @param int $time Not used in this implementation * @return bool */ public function delete( $key, $time = 0 ) { @@ -97,11 +97,11 @@ class XCacheBagOStuff extends BagOStuff { * XCache does not seem to support any way of performing CAS - this however will * provide a way to perform CAS-like functionality. * - * @param $key string - * @param $callback closure Callback method to be executed + * @param string $key + * @param closure $callback Callback method to be executed * @param int $exptime Either an interval in seconds or a unix timestamp for expiry * @param int $attempts The amount of times to attempt a merge in case of failure - * @return bool success + * @return bool Cuccess */ public function merge( $key, closure $callback, $exptime = 0, $attempts = 10 ) { return $this->mergeViaLock( $key, $callback, $exptime, $attempts ); -- 2.20.1